package mybean;

import java.sql.ResultSet;




public class message {
	private String userid;
	private String name;

	private String address;

	private String phone;

	private String dep;

	private String bookname;
	private String press;

	private String number;

	private String day;

	public String getUserid() {
		return userid;
	}

	public void setUserid(String userid) {
		this.userid = userid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getDep() {
		return dep;
	}

	public void setDep(String dep) {
		this.dep = dep;
	}

	public String getBookname() {
		return bookname;
	}

	public void setBookname(String bookname) {
		this.bookname = bookname;
	}

	public String getPress() {
		return press;
	}

	public void setPress(String press) {
		this.press = press;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getDay() {
		return day;
	}

	public void setDay(String day) {
		this.day = day;
	}

	public ResultSet getMessage() {

        String sql = "select * from message   ";

        dbConnect db = new dbConnect();

        ResultSet rs = db.executeQuery(sql);

        return rs;

}
	public void addMessage() {

        String sql = "insert into message(userid,name,address,phone,dep,bookname,press,number,day)  "

                      + "VALUES('"+ userid + "','"+ name + "','" + address+ "','"

                      + phone + "','" + dep + "','" + bookname + "','" + press + "','" + number + "','"+day+ "')";

        dbConnect db = new dbConnect();
        db.executeInsert(sql);

}
	public int deleteMessage(String userid) {

        int num = 0;

        String sql = "delete  from message where userid ='" + userid + "' ";

        dbConnect db = new dbConnect();

        num = db.executeUpdate(sql);

        return num;

}


}
